

package com.hazelcast.client.test.executor.tasks;

import com.hazelcast.client.test.IdentifiedFactory;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;

import java.io.IOException;
import java.util.concurrent.Callable;

/**
 * This class is for Non-java clients as well. Please do not remove or modify.
 */
public class SerializedCounterCallable implements Callable<Integer>, IdentifiedDataSerializable {
    public static final int CLASS_ID = 13;

    private int counter;

    public SerializedCounterCallable() {
    }

    @Override
    public Integer call() throws Exception {
        return counter;
    }

    @Override
    public void writeData(ObjectDataOutput out) throws IOException {
        out.writeInt(counter + 1);
    }

    @Override
    public void readData(ObjectDataInput in) throws IOException {
        counter = in.readInt() + 1;
    }

    @Override
    public int getFactoryId() {
        return IdentifiedFactory.FACTORY_ID;
    }

    @Override
    public int getClassId() {
        return CLASS_ID;
    }
}
